package com.cppsu.cgx.libraryseatselection.controller;

import com.cppsu.cgx.libraryseatselection.common.api.CommonResult;
import com.cppsu.cgx.libraryseatselection.entity.Floor;
import com.cppsu.cgx.libraryseatselection.services.FloorService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: guibo
 * @Description:
 * @Date: Created in 13:19 2021/3/12
 * @Modified By:
 */
@Controller
@Api(tags = "楼层管理")
@RequestMapping("/floor")
@CrossOrigin
public class FloorController {
    @Autowired
    FloorService floorService;
    @GetMapping(value = "/listByLibraryId")
    @ResponseBody
    @PreAuthorize("hasAnyAuthority('admin','user')")
    CommonResult<List<Floor>> listByLibraryId(Long id){
        return CommonResult.success(floorService.listByLibraryId(id));
    }
}
